package com.intellij.GraphEditor;

import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: karpov
 * Date: 28.11.2006
 * Time: 21:59:16
 * To change this template use File | Settings | File Templates.
 */
public class Node {
    int coord_x;
    int coord_y;
    String object_name;
    String comments;
    Editor editor;


    public Node(int coord_x, int coord_y, String node_name,String node_comment, Editor editor) {
        this.coord_x = coord_x;
        this.coord_y = coord_y;
        this.object_name = node_name;
        this.comments =node_comment;
        this.editor = editor;
    }

    void draw_node() {
        Graphics g = editor.output.getGraphics();
        g.fillOval(coord_x, coord_y, 10, 10);
        g.drawString(object_name, coord_x, coord_y);
    }

    void delete_node() {
        Graphics g = editor.output.getGraphics();
        g.clearRect(coord_x, coord_y - 10, 10, 20);
        //      Editor.repaint_(g);
// TODO
    }

    void highlight_node() {
        Graphics g = editor.output.getGraphics();
        g.setColor(Color.red);
        g.fillOval(coord_x, coord_y, 10, 10);
        editor.CommentTextArea.setText(comments);
    }

    void unhighlight_node() {
        Graphics g = editor.output.getGraphics();
        g.fillOval(coord_x, coord_y, 10, 10);
        g.drawString(object_name, coord_x, coord_y);
        editor.CommentTextArea.setText("");
    }
}
